package com.yfyszk.kingbird.controller;


import com.yfyszk.kingbird.common.result.ApiResult;
import com.yfyszk.kingbird.common.utils.PageInfo;
import com.yfyszk.kingbird.common.utils.PageUtils;
import com.yfyszk.kingbird.common.utils.R;
import com.yfyszk.kingbird.feign.OrderFeignClient;
import com.yfyszk.kingbird.feign.UserFeignClient;
import com.yfyszk.kingbird.service.ICouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;


/**
 * test
 *
 * @author cx
 * @more   www.cx1314.cn
 * @date 2020-05-22 19:35:30
 */
@Slf4j
@RestController
@RequestMapping("/order")
@Api("订单服务")
@CrossOrigin
public class OrderController implements OrderFeignClient{
    @Autowired
    private UserFeignClient userFeignClient;
    @ApiOperation("会员服务getOrder接口")
    @Override
    public String getOrder(String orderId) {
        //调用用户系统
        System.out.println("用户下单成功");
        R userByOrderId = userFeignClient.getUserByOrderId("11111");
        System.out.println(userByOrderId);
        return "恭喜你下单成功:"+orderId;
    }
    /*** 用户调用查询订单的接口
     * @author wgc
     *@date 2021/2/25 0025 18:09
     * @param userId
     * @return com.yfyszk.kingbird.common.utils.R
     */
    @Override
    public R findeOrderByUserId(String userId) {
        String data=userId+"的订单已发货";
        return R.ok().setData(data);
    }

    @Override
    public ApiResult findeOrderByUserIdTest(String userId) {
        String data=userId+"的订单已发货1111";
        return ApiResult.success(data);
    }


}
